import services from '../services/theOneServices';

const state = {
    items:[],
}

const getters = {
    itemCount:(state) => {
        return state.items.length
    },
}

const mutations = {
    setItems(state,list){
        state.items.push(...list);
    }
}

const actions = {
    queryItems({commit},payload){
        commit('setItems',[]);
        services.getItemsList(payload,data =>{
            commit('setItems',data);
        },null);
    }
}

export default{
    namespaced:true,
    state,
    getters,
    actions,
    mutations
}